package com.ibigcat.module.mdm.dao.mapper;

import java.util.*;

import com.ibigcat.framework.common.pojo.PageResult;
import com.ibigcat.framework.mybatis.core.query.LambdaQueryWrapperX;
import com.ibigcat.framework.mybatis.core.mapper.BaseMapperX;
import com.ibigcat.module.mdm.dao.entity.CodeRuleDO;
import org.apache.ibatis.annotations.Mapper;
import com.ibigcat.module.mdm.controller.admin.coderule.vo.*;

/**
 * 编码规则配置 Mapper
 *
 * @author 芋道源码
 */
@Mapper
public interface CodeRuleMapper extends BaseMapperX<CodeRuleDO> {

    default PageResult<CodeRuleDO> selectPage(CodeRulePageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<CodeRuleDO>()
                .likeIfPresent(CodeRuleDO::getNodeName, reqVO.getNodeName())
                .eqIfPresent(CodeRuleDO::getNodeCode, reqVO.getNodeCode())
                .eqIfPresent(CodeRuleDO::getNodeRule, reqVO.getNodeRule())
                .eqIfPresent(CodeRuleDO::getSource, reqVO.getSource())
                .eqIfPresent(CodeRuleDO::getRemark, reqVO.getRemark())
                .betweenIfPresent(CodeRuleDO::getCreateTime, reqVO.getCreateTime())
                .orderByDesc(CodeRuleDO::getId));
    }

}